@extends('layouts.app')
@section('web_title','血糖')


@section('css')
    <link href="{{ asset('css/FBG.css') }}" rel="stylesheet">
    {{--<link rel="stylesheet" href="css/easyui.css">--}}
    <link href="{{ asset('css/reportPrint.css') }}" rel="stylesheet">
    <link href="{{ asset('css/easyui.css') }}" rel="stylesheet">
    <link href="{{ asset('css/main.css') }}" rel="stylesheet">
@endsection

<div class="bgCover display-none"
     style="position:fixed;z-index:10000;width:100%;height:100%;top:0;background-color: rgba(0,0,0,0.7)">
    <div class="center">

        <img src="" alt="">
    </div>
</div>
@section('content')
    <!--右侧内容-->
    {{--<div id="page-wrapper" class="gray-bg dashbard-1">--}}
    <!--操作区域-->
    <!--照片显示modal-->


    <div class=""></div>
    <!--todo 内容区域-->
    <input type="hidden" id="user_id" value="">
    <input type="hidden" id="FSBH" value="">
    <input type="hidden" id="CGBH" value="">
    <div id="bgNav">


        <div class="navTab">
            <!--<div class="">-->
            <!-- Nav tabs -->
            <ul class="nav">
                <li class="@if ($type == 1) active @endif  col-xs-6 fbgLi">
                    <div class="bgTab " id="fbgTab"><a>静脉/指尖血糖</a><i></i></div>
                </li>
                <li class="col-xs-6 dbgLi @if ($type == 2) active @endif">
                    <div class="bgTab  " id="dbgTab"><a>动态血糖</a><i></i></div>
                </li>
            </ul>
            <!--</div>-->
        </div>

    </div>
    <div id="BG">


        <div id="FBG">
            <div class="top">
                <div class="FBGRange">
                    <div class="FBGSet">
                        <h3 class="BGHeader">
                            <span class="Text">血糖值设置</span>
                            <span class="Unit">单位：mmol/l</span>
                        </h3>
                        <ul class="stageList">
                            <li class="preMeal">
                                <div class="stageText"><i class="circle"></i>餐前</div>
                                <div style="clear: both"></div>
                                <div class="default"><span>推荐值：</span> <span class="defVal">3.9 - 6.1</span></div>
                                <div class="setText"><span>自定义：</span> <input class="setLeftVal pre_meal_s small" value=""> -
                                    <input class="setRightVal pre_meal_l large" value="">
                                </div>
                            </li>
                            <li class="preMeal">
                                <div class="stageText"><i class="circle"></i>餐后</div>
                                <div style="clear: both"></div>
                                <div class="default"><span>推荐值：</span> <span class="defVal">4.4 - 7.8</span></div>
                                <div class="setText"><span>自定义：</span> <input class="setLeftVal after_meal_s small" value=""> -
                                    <input class="setRightVal after_meal_l large" value="">
                                </div>
                            </li>
                            <li class="preMeal">
                                <div class="stageText"><i class="circle"></i>睡前</div>
                                <div style="clear: both"></div>
                                <div class="default"><span>推荐值：</span> <span class="defVal">3.9 - 6.1</span></div>
                                <div class="setText"><span>自定义：</span> <input class="setLeftVal before_bed_s small" value=""> -
                                    <input class="setRightVal large before_bed_l" value="">
                                </div>
                            </li>
                            <li class="preMeal">
                                <div class="stageText"><i class="circle"></i>凌晨</div>
                                <div style="clear: both"></div>
                                <div class="default"><span>推荐值：</span> <span class="defVal">3.9 - 6.1</span></div>
                                <div class="setText"><span>自定义：</span> <input class="setLeftVal wee_hours_s small" value=""> -
                                    <input class="setRightVal wee_hours_l large" value="">
                                </div>
                            </li>
                        </ul>

                        <button class="FBGRangeSave btn btn-primary">保存</button>
                    </div>
                </div>
                <div class="FBGChartDateLeft">
                    <div class="searchFBG">
                        <b>血糖查询</b>
                        <input id="bloodSearchInput" class="form-control datepicker maxMonth" placeholder="日期"
                               data-toggle="datepicker" type="text"
                               dataformatas="datapacker">

                        <div class="SelfWarning">
                            <i style="color:#65C531">●</i><span style="color:#65C531">正常</span>
                            <i style="color:#ED4040">●</i><span style="color:#ED4040">偏高</span>
                            <i style="color:#2DB3C5">●</i><span style="color:#2DB3C5">偏低</span>
                            {{--<i style="color:#F85443">●</i><span style="color:#F85443">异类预警</span>--}}
                        </div>
                    </div>
                    <ul class="showType">
                        <li class="active" data-name="BloodSugar">血糖</li>
                        <li data-name="Diet">饮食</li>
                        <li data-name="Drug">用药</li>
                        <li data-name="Insulin">胰岛素</li>
                        <li data-name="motion">运动</li>
                        <div id="export" class="export"><i class="glyphicon glyphicon-open-file"></i>导出</div>
                    </ul>
                    <div id="contentSwitch">
                        <!-- 血糖 -->
                        <div class="BloodSugar">
                            <table class="table headT table-bordered table-hover text-center">
                                <thead>
                                <tr>
                                    <td>日<span class="spanHide">日</span>期</td>
                                    <td>早餐前</td>
                                    <td>早餐后</td>
                                    <td>午餐前</td>
                                    <td>午餐后</td>
                                    <td>晚餐前</td>
                                    <td>晚餐后</td>
                                    <td>睡<span class="spanHide">日</span>前</td>
                                    <td style="border-right:none">凌<span class="spanHide">日</span>晨</td>
                                </tr>
                                <tbody>
                                </tbody>

                                </thead>
                            </table>
                            <div class="bodyDiv">
                                <table class="table  table-bordered table-hover text-center" id="ChartTable">
                                    <tbody class="ChartTbody"></tbody>
                                </table>
                            </div>
                        </div>

                        <!-- 饮食 -->
                        <div class="Diet"></div>

                        <!-- 用药 -->
                        <div class="Drug"></div>

                        <!-- 胰岛素 -->
                        <div class="Insulin"></div>

                        <!-- 运动 -->
                        <div class="motion"></div>

                    </div>

                </div>
            </div>

            <div class="probability">
                <h3 class="text">概率统计</h3>
                <div class="week">
                    <div class="top">
                        <div class="time col-lg-4 text-center">最近一周</div>
                        <div class="average col-lg-4 text-center"><span class="text">平均值：</span><span
                                    class="value">0</span></div>
                        <div class="times col-lg-4 text-center"><span class="text">记录次数：</span><span
                                    class="value"></span> <span style="font-size: 20px;color: #333">次</span></div>
                    </div>
                    <div class="bottom">
                        <div class="col-lg-4">
                            <div class="bottomMain bottomMainNormal">
                                <div class="cir">
                                    <div class="text">正常</div>
                                    <div class="value n"><span></span>次</div>
                                </div>
                            </div>
                            <div class="percen n">

                            </div>
                        </div>
                        <div class="col-lg-4">
                            <div class="bottomMain bottomMainHigh">
                                <div class="cir">
                                    <div class="text">偏高</div>
                                    <div class="value h"><span></span>次</div>
                                </div>

                            </div>
                            <div class="percen h">

                            </div>
                        </div>
                        <div class="col-lg-4">
                            <div class="bottomMain bottomMainLow">
                                <div class="cir">
                                    <div class="text">偏低</div>
                                    <div class="value l"><span></span>次</div>
                                </div>
                            </div>
                            <div class="percen l">

                            </div>
                        </div>

                    </div>
                </div>
                <div class="oneMonth">
                    <div class="top">
                        <div class="time col-lg-4 text-center">最近一个月</div>
                        <div class="average col-lg-4 text-center"><span class="text">平均值：</span><span
                                    class="value"></span></div>
                        <div class="times col-lg-4 text-center"><span class="text">记录次数：</span><span
                                    class="value"></span><span style="font-size: 20px;color: #333">次</span></div>
                    </div>
                    <div class="bottom">
                        <div class="col-lg-4">
                            <div class="bottomMain bottomMainNormal">
                                <div class="cir">
                                    <div class="text">正常</div>
                                    <div class="value n"><span></span>次</div>
                                </div>
                            </div>
                            <div class="percen n">

                            </div>
                        </div>
                        <div class="col-lg-4">
                            <div class="bottomMain bottomMainHigh">
                                <div class="cir">
                                    <div class="text">偏高</div>
                                    <div class="value h"><span></span>次</div>
                                </div>

                            </div>
                            <div class="percen h">

                            </div>
                        </div>
                        <div class="col-lg-4">
                            <div class="bottomMain bottomMainLow">
                                <div class="cir">
                                    <div class="text">偏低</div>
                                    <div class="value l"><span></span>次</div>
                                </div>
                            </div>
                            <div class="percen l">

                            </div>
                        </div>

                    </div>
                </div>
                <div class="threeMonth">
                    <div class="top">
                        <div class="time col-lg-4 text-center">最近三个月</div>
                        <div class="average col-lg-4 text-center"><span class="text">平均值：</span><span
                                    class="value">5.8</span></div>
                        <div class="times col-lg-4 text-center"><span class="text">记录次数：</span><span
                                    class="value"></span><span style="font-size: 20px;color: #333">次</span></div>
                    </div>
                    <div class="bottom">
                        <div class="col-lg-4">
                            <div class="bottomMain bottomMainNormal">
                                <div class="cir">
                                    <div class="text">正常</div>
                                    <div class="value n"><span></span>次</div>
                                </div>
                            </div>
                            <div class="percen n">

                            </div>
                        </div>
                        <div class="col-lg-4">
                            <div class="bottomMain bottomMainHigh">
                                <div class="cir">
                                    <div class="text">偏高</div>
                                    <div class="value h"><span></span>次</div>
                                </div>

                            </div>
                            <div class="percen h">

                            </div>
                        </div>
                        <div class="col-lg-4">
                            <div class="bottomMain bottomMainLow">
                                <div class="cir">
                                    <div class="text">偏低</div>
                                    <div class="value l"><span></span>次</div>
                                </div>
                            </div>
                            <div class="percen l">

                            </div>
                        </div>

                    </div>
                </div>
            </div>

            <div class="FBGChartDate">
                <div class="FBGChartDateRight">
                    <h3 class="title">整月血糖</h3>
                    <div id="FBGChart1" style="height:300px;"></div>
                    <div id="FBGChart2" style="height:300px;"></div>
                </div>
            </div>


        </div>


        <div id="DBG">
            <div id="RBGModel">
                <div class="RBGModelHead">参比血糖</div>
                <div class="RBGModelBody">
                    <h3>
                        <div class="parentOUt">
                            <b class="col-xs-4">时间</b>
                            <input class="easyui-datetimebox form-control form_datetime col-xs-7"
                                   id="bootPickerDate" data-options="closeText:'关闭',currentText:
        '当前时间',okText:'确定',formatter:myformatter,parser:myparser" name="starttime" style="width: 100%!important;"
                                   type="text"/>


                            <!--                                <input id="bootPickerDate" class="form-control form_datetime col-xs-7" size="16"-->
                            <!--                                       readonly>-->

                        </div>
                        <div class="parentOUt">
                            <b class="col-xs-4">参比血糖</b> <input id="RBGVal" type="number"
                                                                class="numberStrict form-control col-xs-6"><b
                                    class="unit col-xs-2">mmol/L</b>

                        </div>
                        <div class="maxAlert">注:最大血糖值为50mmol/L超过此值默认为最大值显示</div>
                    </h3>
                </div>
                <div class="RBGModelFoot">
                    <button class="RGBCancel">取消</button>
                    <button class="RGBCave">保存</button>
                </div>
            </div>

            <div id="printModel">
                <div class="RBGModelHead">打印报告</div>
                <div class="RBGModelBody">
                    <h3>
                        <div class="parentOUt">
                            <b class="col-xs-4">开始时间</b>
                            <!--                                <input id="bootPickerStartDate" class="form-control form_datetime col-xs-7"-->
                            <!--                                                                    size="16" readonly>-->
                            <input style="width: 100%!important;"
                                   class="easyui-datetimebox form-control form_datetime col-xs-7"
                                   id="bootPickerStartDate" data-options="closeText:'关闭',currentText:
        '当前时间',okText:'确定',formatter:myformatter,parser:myparser" name="starttime" type="text"/>

                        </div>
                        <div class="parentOUt">
                            <b class="col-xs-4">结束时间</b>
                            <!--                                <input id="bootPickerEndDate" class="form-control form_datetime col-xs-7" size="16" readonly>-->
                            <input style="width: 100%!important;"
                                   class="easyui-datetimebox form-control form_datetime col-xs-7"
                                   id="bootPickerEndDate" data-options="closeText:'关闭',currentText:
        '当前时间',okText:'确定',formatter:myformatter,parser:myparser" name="endtime" type="text"/>

                        </div>
                    </h3>
                </div>
                <div class="RBGModelFoot">
                    <button class="printCancelBtn">取消</button>
                    <button class="printBtn">打印</button>
                </div>
            </div>

            <ul class="DBGChildTab">
                <li data-id="BGChart" class="active">血糖图谱</li>
                <li data-id="WearRecord" class="">佩戴记录</li>
                <li data-id="ViewEvent" class="">查看事件</li>
            </ul>

            {{--血糖图普 ⬇️--}}
            <div id="BGChart" class="counterDiv">
                <div id="DBGMain">

                    <div class="navRecord">
                        <span class="text">佩戴记录</span>
                        <div class="over_X">
                            <ul class="record">

                            </ul>

                        </div>
                    </div>
                    <div class="ReferenceBG">

                        <button class="btn addReferenceBGBtn">录入参比血糖</button>


                    </div>
                    <div class="ContinuouslyPic">
                        <span class="cirSpan first">
                            <i class="Cir">●</i>
                            <span>连续血糖图</span>
                        </span>

                        <a class="look">查看日志</a>
                        <div id="chart2-1a" class="chart2-2 chart2-2a" data-highcharts-chart="3">
                            <div id="highcharts-0" style="overflow: visible;width: 100%!important; "></div>
                        </div>
                        <div class="chart2-1a-table" style="display: none">
                            <table class="table-bordered table-hover text-center table" id="chartTable">
                                <thead>
                                <tr>
                                    <td>时间</td>
                                    <td>血糖值</td>
                                    <td>电流值</td>
                                </tr>
                                </thead>
                                <tbody>
                                </tbody>
                            </table>

                        </div>


                    </div>
                    <div class="DayPic">
                        <span class="cirSpan">
                            <i class="Cir">●</i>
                            <span>日间同比血糖图</span>
                        </span>
                        <!--                        <a class="look">查看日志 </a>-->
                        <div id="chart2-2b" class="chart2-2 chart2-2b">
                            <div id="highcharts-4" style="width: 100%!important;"></div>
                        </div>
                    </div>
                    <div class="referListPic">
                        <span class="cirSpan">
                            <i class="Cir">●</i>
                            <span>高低血糖百分比</span>
                        </span>
                        <!--                        <a class="look">查看日志</a>-->
                        <div id="chart2-2c" class="chart2-2 chart2-2c">
                            <div id="highcharts-114" style="width: 100%!important;"></div>
                        </div>
                    </div>
                    <div class="DietPic">
                        <span class="cirSpan">
                            <i class="Cir">●</i>
                            <span>饮食事件同比图谱</span>
                        </span>
                        <!--                        <a class="look">查看日志</a>-->
                        <div id="chart2-2d" class="chart2-2 chart2-2d">
                            <div id="highcharts-120" style="width: 100%!important;"></div>
                        </div>
                    </div>
                    <div class="InsuliPic">
                        <span class="cirSpan">
                            <i class="Cir">●</i>
                            <span>胰岛素同比图谱</span>
                        </span>
                        <!--                        <a class="look">查看日志</a>-->
                        <div id="chart2-2e" class="chart2-2 chart2-2e">
                            <div id="highcharts-139" style="width: 100%!important;"></div>
                        </div>
                    </div>

                </div>
            </div>
            {{--佩戴记录 ⬇️--}}
            <div id="WearRecord" class="counterDiv" style="display: none">
                <table class="table-bordered table-hover text-center table"></table>
            </div>

            {{--查看事件 ⬇️--}}
            <div id="ViewEvent" class="counterDiv" style="display: none">
                <table class="table-bordered table-hover text-center table"></table>

            </div>

        </div>

    </div>

    <a href="" style="display: none" download="血糖导出{{ \Carbon\Carbon::now()->toDateString() }}.xlsx" id="hf"></a>
    </div>

    {{--</div>--}}

@endsection

@section('js')

    <!--cookie的文件引入-->
    <script src="{{ asset('js/jquery.cookie.js') }}"></script>
    {{--    <script src="{{ asset('static/bootstrap/js/bootstrap.min.js') }}"></script>--}}
    <script src="{{ asset('js/xlsx.full.min.js') }}"></script>

    <script src="{{ asset('js/common_c.js') }}"></script>
    <script src="{{ asset('js/echarts.common.min.js') }}"></script>
    <script src="{{ asset('js/higtcharts.js') }}"></script>
    <script src="{{ asset('js/higtcharts-3D.js') }}"></script>
    <script src="{{ asset('js/chartProcess.js') }}"></script>
    <script src="{{ asset('js/FBG.js') }}"></script>
    <script src="{{ asset('js/bootstrap-datetimepicker.js') }}"></script>
    <script src="{{ asset('js/bootstrap-datetimepicker.zh-CN.js') }}"></script>
    <script src="{{ asset('js/jquery.easyui.min.js') }}"></script>
    <script src="{{ asset('js/easyui-lang-zh_CN.js') }}"></script>
    <script>
        function dateInit() {
            var date = new Date();

            function formatDate(date) {
                var y = date.getFullYear();
                var m = date.getMonth() + 1;
                m = m < 10 ? '0' + m : m;
                var d = date.getDate();
                d = d < 10 ? ('0' + d) : d;
                return y + '-' + m + '-' + d;
            };
            $('.maxMonth').datepicker({
                minViewMode: 1,
                format: 'yyyy-mm',
                endDate: formatDate(date)
            });//日历最多显示到月  end

        };
        dateInit();

        //限制日期不嫩超过今日；
        function myformatter(date) {
            var today = new Date();
            if (date > today) {
                $.messager.show({
                    title: '消息提示',
                    msg: '您选择的日期超过今天，请重新选择111。',
                    timeout: 1500,
                    showType: 'fade',
                    style: {
                        right: '',
                        bottom: ''
                    }
                });
                return
            } else {
                var y = date.getFullYear();
                var m = date.getMonth() + 1;
                var d = date.getDate();
                var h = date.getHours();
                var i = date.getMinutes();
                var s = date.getSeconds();
                (Number(h) < 10) && (h = "0" + h);
                (Number(i) < 10) && (i = "0" + i);
                (Number(s) < 10) && (s = "0" + s);
                return y + '-' + (m < 10 ? ('0' + m) : m) + '-' + (d < 10 ? ('0' + d) : d) + " " + h + ":" + i + ":" + s;
            }
        }

        //时间补零
        function myparser(s) {
            if (!s) return new Date();
            s = s.replace(/[ ,:]/ig, "-");
            var ss = (s.split('-'));
            var y = parseInt(ss[0], 10);
            var m = parseInt(ss[1], 10);
            var d = parseInt(ss[2], 10);
            var h = parseInt(ss[3], 10);
            var i = parseInt(ss[4], 10);
            var s = parseInt(ss[5], 10);

            if (!isNaN(y) && !isNaN(m) && !isNaN(d) && !isNaN(h) && !isNaN(i) && !isNaN(s)) {
                return new Date(y, m - 1, d, h, i, s);
            } else {
                return new Date();
            }
        }
    </script>

    <script type="text/javascript">
        //获取url中"?"符后的字串,返回对象⬇️
        function GetRequest() {
            var url = location.search; //获取url中"?"符后的字串
            var theRequest = new Object();
            if (url.indexOf("?") != -1) {
                var str = url.substr(1);
                strs = str.split("&");
                for (var i = 0; i < strs.length; i++) {
                    theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
                }
            }
            return theRequest;
        }

        var Request = new Object();
        var urlData = GetRequest();
        $("input#user_id").val(urlData.record_id);
        //添加参比模态框事件绑定⬇️
        $("#RBGModel").delegate('input.textbox-text', 'click', function () {
            $(this).prev('span').children('a').click();
            $(this).blur();
        });

        //点击添加参比按钮绑定事件⬇️
        $(".ReferenceBG .addReferenceBGBtn").unbind().click(function () {
            $("#RBGModel").find('input').val('');
            $("#RBGModel").fadeIn("normal");
        });
        $("#RBGModel button.RGBCancel").unbind().click(function () {
            $("#RBGModel").fadeOut("normal");
        });

        //点击打印按钮弹出打印模态框⬇️
        $("#printModel button.printCancelBtn").click(function () {
            $("#RBGModel,#printModel").fadeOut("normal");
        });
        //佩戴记录⬇️
        $(function () {
            var url = location.origin;
            var WearRecord = {
                init: function () {
                    ajax('get', url + '/dynamic/samWear/getListInfo', {user_id: $("#user_id").val()}, function (data) {
                        if (data.code == 10000) {
                            var data = data.data;
                            var tableHtml = '';
                            var beforeHtml = '';
                            var afterHtml = '';
                            $.each(data, function (k, v) {
                                tableHtml += '<tr>' +
                                    '<td class="fstd">' + checkUndefined(v.emittercode) + '</td>' +
                                    '<td class="cgtd">' + checkUndefined(v.sensorcode) + '</td>' +
                                    '<td class="startTime">' + checkUndefined(v.starttime) + '</td>' +
                                    '<td class="endTime">' + checkUndefined(v.endtime) + '</td>' +
                                    '<td>' + checkUndefined(v.data.count) + '</td>' +
                                    '<td>' + checkUndefined(v.data.avg) + '</td>' +
                                    '<td>' + checkUndefined(v.data.max) + '</td>' +
                                    '<td>' + checkUndefined(v.data.min) + '</td>' +
                                    '<td>' + checkUndefined(v.data.spacing) + '</td>' +
                                    '<td>' + checkUndefined(v.data.sdbg) + '</td>' +
                                    '<td>' +
                                    '<button class="printBtn">打印报告</button>' +
                                    '</td>' +
                                    '</tr>'
                            });
                            if (tableHtml !== "") {
                                beforeHtml = '<thead>' +
                                    '<tr>' +
                                    '<td>发射器编号</td>' +
                                    '<td>传感器编号</td>' +
                                    '<td>开始时间</td>' +
                                    '<td>结束时间</td>' +
                                    '<td>采集数</td>' +
                                    '<td>平均值</td>' +
                                    '<td>最高值</td>' +
                                    '<td>最低值</td>' +
                                    '<td>最大波动幅度</td>' +
                                    '<td>水平标准差(sdbg)</td>' +
                                    '<td>操作</td>' +
                                    '</tr>' +
                                    '</thead>' +
                                    '<tbody>';
                                afterHtml = '</tbody></table>'
                            }
                            $("#WearRecord table").html(beforeHtml + tableHtml + afterHtml);
                            WearRecord.control();
                        } else if (data.code == 40001) {
                            $("#WearRecord").html('<h3 style="text-align:center;">暂无数据</h3>')
                        } else {
                            alertModel("温馨提示", data.message)

                        }
                    });

                },
                control: function () {
                    $("#WearRecord").find(".printBtn").unbind().click(function () {

                        $("input#FSBH").val($(this).parents('tr').find("td.fstd").html());
                        $("input#CGBH").val($(this).parents('tr').find("td.cgtd").html());


                        $("#printModel").find('input[name="starttime"]').val($(this).parents('tr').find('.startTime').html());
                        $("#printModel").find('input[name="starttime"]').prev("input").val($(this).parents('tr').find('.startTime').html());
                        $("#printModel").find('input[name="endtime"]').val($(this).parents('tr').find('.endTime').html());
                        $("#printModel").find('input[name="endtime"]').prev("input").val($(this).parents('tr').find('.endTime').html());

//                        $("#printModel").find("input").val("");
                        $("#printModel").fadeIn("normal");


                    });
                    $("#printModel button.RGBCancel").unbind().click(function () {
                        $("#printModel").fadeOut("normal");
                    });

                    //打印报告
                    $("#printModel").find(".printBtn").unbind().click(function () {

                        var stime = $("#printModel").find('input[name="starttime"]').val();
                        var etime = $("#printModel").find('input[name="endtime"]').val();
                        if (stime == '') {
                            alertModel("温馨提示", "开始时间不能为空！")
                        } else if (etime == '') {
                            alertModel("温馨提示", "结束时间不能为空！")
                        } else {
                            if (compareTime(stime, etime)) {
                                window.open("/manage/reportPrint?startTime=" + stime + "&endTime=" + etime +
                                    "&user_id=" + $("#user_id").val() +
                                    "&id=" + $("#DBGMain ul.record li.hasBorder").attr("data-id") +
                                    "&fsbh=" + $("input#FSBH").val() +
                                    "&cgbh=" + $("input#CGBH").val()
                                );
                            } else {
                                alertModel('温馨提示', "开始时间不能小于结束时间！")
                            }
                        }
                    });
                    $("#RBGModel,#printModel").fadeOut("normal");

                    $("#printModel input[name='starttime'],#printModel input[name='endtime']").prev().click(function () {
                        $(this).prev().children('a').click();
                        $(this).blur();
                    })

                },
            };
            setTimeout(function(){
                WearRecord.init();
            },100);

        });

        //查看事件⬇️
        $(function () {
            var ViewEvent = {
                init: function () {
                    ajax('get', url + "/dynamic/bloodEvent/getListByUid", {user_id: $("#user_id").val()}, function (data) {
                        if (data.code == 10000) {
                            var data = data.data;
                            var html = '';
                            var beforeHtml = '';
                            var afterHtml = '';
                            $.each(data, function (k, v) {
                                html +=
                                    '<tr>' +
                                    '<td>' + checkUndefined(v.type) + '</td>' +
                                    '<td>' + checkUndefined(v.name) + '</td>' +
                                    '<td>' + checkUndefined(v.time) + '</td>' +
                                    '</tr>'
                            });
                            if (data !== []) {
                                beforeHtml = '<thead>' +
                                    '<tr>' +
                                    '<td>事件类型</td>' +
                                    '<td>事件名称</td>' +
                                    '<td>添加时间</td>' +
                                    '</tr>' +
                                    '</thead>' +
                                    '<tbody>';
                                afterHtml = '</tbody></table>';
                                $("#ViewEvent table").html(beforeHtml + html + afterHtml)
                            }

                            ViewEvent.control();
                        } else if (data.code == 40001) {
                            $("#ViewEvent").html('<h3 style="text-align:center;">暂无数据</h3>')
                        } else {
                            alertModel("温馨提示", data.message)
                        }
                    });

                },
                control: function () {

                    $("#RBGModel,#printModel").fadeOut("normal");
                }
            };
            setTimeout(function() {
                ViewEvent.init();
            },100);

        });

    </script>

    <script>
        $('#side-menu li.caseList').addClass('active');//更改导航列表选中样式   不可删除

    </script>

@endsection